litctf Robbie Wanna Revenge

前言

最近学了点frida-windows想到了litctf最后一道题可以主动调用来获取flag 但大多是用的ce 我突发奇想试试frida 水一下

image-20250607014316449

前置内容省略了 大体的思路就是主动调用

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var baseaddres =Process.findModuleByName("GameAssembly.dll")
console.log(baseaddres);


const RobbieGetFlag = new NativeFunction(
baseaddres.base.add(0x7A52A0),
'int64', // __int64 返回类型
[] // 无参
);

try {
// 调用函数
const result = RobbieGetFlag();

// 将返回的int64转换为字符串
// 方法1:直接显示
console.log(`Robbie__GetFlag 返回: ${result}`);

// 方法2:如果返回的是指针,可以读取字符串
// const flagStr = ptr(result).readUtf8String();
// console.log(`Flag: ${flagStr}`);

// 方法3:十六进制显示
console.log(`十六进制: 0x${result.toString(16)}`);



console.log(hexdump(ptr(0x1fba348db40), {offset: 0,length: 200,header: false,ansi: true}))


} catch (e) {
console.error("调用 Robbie__GetFlag 失败:", e);
}


// var symbols = Process.enumerateModules()

// 遍历并打印符号信息
// symbols.forEach(symbols =>{
// console.log('Name:', symbols.name,
// 'Type:', symbols.size,
// 'Module:', symbols.base,
// 'Address:', symbols.path)
// })

image-20250607014452214

就可以看到在内存中flag就加载出来了